import request from '@/router/axios';

/**
 * @param current 当前页
 * @param size 每页数据量
 * @returns {AxiosPromise}
 */
export const getParentList = (current, size,params) => {
  return request({
    url: '/api/hg-logistics/labelrule/label-rule/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}


export const getChildList = (current, size, ruleId) => {
  return request({
    url: '/api/hg-logistics/labellog/label-log/page-by-rule',
    method: 'get',
    params: {
      ruleId,
      current,
      size,
    }
  })
}


export const add = (row) => {
  return request({
    url: '/api/hg-logistics/labelrule/label-rule/add',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/hg-logistics/labelrule/label-rule/update',
    method: 'post',
    data: row
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/hg-logistics/labelrule/label-rule/remove',
    method: 'delete',
    params: {
      ids,
    }
  })
}

export const getMaterialList = (current,size,data) => {
  return request({
    url: '/api/hg-public/material/info/page',
    method: 'get',
    params: {
      ...data,
      current,
      size,
    }
  })
}

export const getCustomerList = () => {
  return request({
    url: '/api/hg-public/customerlinkman/selectCustomer',
    method: 'get',
  })
}

export const getUnitList = () => {
  return request({
    url: '/api/hg-public/unit/list-none-page',
    method: 'get',
  })
}

export const create = (data) => {
  return request({
    url: '/api/hg-logistics/labelrule/label-rule/generator',
    method: 'post',
    data: data,
    responseType:'blob',
  })
}
export const getTempleList = (customerCode) => {
  return request({
    url: '/api/hg-logistics/labelrule/label-template/list',
    method: 'get',
    params:{
      customerCode,
    }
  })
}
